# coding = utf-8

'''
针对3DIRCADb数据的一个分析
'''

import os
import numpy as np

def culate_tumor_size():
    data_path = "/datasets/3Dircadb/chengkung"
    for i in range(20):
        case_id = "case_{}".format(str(i).zfill(5))
        case_path = os.path.join(data_path, case_id)
        segment_path = os.path.join(case_path, "segmentation")
        tumor = 0
        for item in os.listdir(segment_path):
            file = os.path.join(segment_path, item)
            data = np.load(file)
            tumor += (data == 2).sum()

        print(case_id, tumor)




if __name__ == '__main__':
    culate_tumor_size()